package com.gsp.cloud.clientfeign.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "client",fallback = HiService.HiErrorFallback.class)
public interface HiService {

    @RequestMapping(value = "/hi",method = RequestMethod.GET)
    String sayHiFromClientOne(@RequestParam(value = "name") String name);

    @Component
    static class HiErrorFallback implements HiService{

        @Override
        public String sayHiFromClientOne(String name) {
                return "hi,"+name+",sorry,error!";
        }
    }
    
}
